function h = generateDiff2DHist( img_coef, T, USE_ABS )
%GENERATEDIFF2DHIST
% Input:
%  USE_ABS : use ABS(IMG_COEF) instead of IMG_COEF. Default setting is 1.
%            But when analysis F4, turn it off may result better result.
% Output
%  H : 4*(2N+1)^2 dimension
    if nargin < 3
        USE_ABS = 1;
    end
    if USE_ABS
        img_coef = abs(img_coef);
    end
    [img1, img2, img3, img4] = diff_JPEG2D(img_coef, T);
    h1 = generateHist2D(img1, T, 'h');
    h2 = generateHist2D(img2, T, 'v');
    h3 = generateHist2D(img3, T, 'm');
    h4 = generateHist2D(img4, T, 'r');
    h = [h1(:);h2(:);h3(:);h4(:)]';
end

